#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

const int N = 1000010;
int t, tot;
int val[N], fail[N], trie[N][26], last[N];
char string[N];

void insert(char *str) {
	int n = strlen(str), cur = 0;
	for (int i = 0; i < n; ++i) {
		int c = str[i] - 'a';
		if (!trie[cur][c]) trie[cur][c] = ++tot;
		cur = trie[cur][c];
	}
	val[cur]++;
}

void getfail() {
	queue< int > q;
	q.push(0);
	while (!q.empty()) {
		int u = q.front(), k = fail[u];
		q.pop();
		for (int i = 0; i < 26; ++i) {
			int v = trie[u][i];
			if (!v) {
				trie[u][i] = trie[k][i];
				continue;
			}
			q.push(v);
			fail[v] = u ? trie[k][i] : 0;
			last[v] = val[fail[v]] ? fail[v] : last[fail[v]];
		}
	}
}

int query(char *str) {
	int cur = 0, n = strlen(str), res = 0;
	for (int i = 0; i < n; ++i) {
		int c = str[i] - 'a';
		cur = trie[cur][c];
		if (val[cur]) res += val[cur], val[cur] = 0;
		int v = cur;
		while (last[v]) {
			v = last[v];
			if (val[v]) res += val[v], val[v] = 0;
		}
	}
	return res;
}

int main() {

#ifndef ONLINE_JUDGE
#ifdef DEBUG
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef DEBUG
	freopen("ACAutoMachine.in", "r", stdin);
	freopen("ACAutoMachine.out", "w", stdout);
#endif
#endif

	scanf("%d", &t);
	for (int i = 1; i <= t; ++i) {
		scanf("%s", string);
		insert(string);
	}
	getfail();
	scanf("%s", string);
	printf("%d", query(string));
	return 0;
}